Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Discord.js invalid form body: value "voiceChannel" is not snofwlake

I'm trying to code a music bot, and I coded a system that understands if the channel to join is valid or not, but when I input an invalid channel, the bot crashes and gives me this error: Invalid form body, channel_id: Value "args[0]" is not snowflake. What can I do? Code:

module.exports = {
    name: "join",
    aliases: ["j", "move"],

    async execute (client, message, args, Discord) {

        let voiceChannel = message.member.voice.channel;

        if (args[0]) {

            voiceChannel = await client.channels.fetch(args[0]);

            if (!Discord.Constants.VoiceBasedChannelTypes.includes(voiceChannel?.type)) {
                
                return message.reply(`Sadly, ${args[0]} is kinda not a valid voice channel :(`);
            }
        }
        
        if (!voiceChannel) return message.reply("You have to be in a voice channel you dummy! ๐Ÿ˜ณ๐Ÿ‘‰๐Ÿ‘ˆ");

        client.distube.voices.join(voiceChannel);
    }
}
about 4 years ago ยท Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!